<!DOCTYPE html>
<html lang="zh">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>动画状态2</title>
  <style>
    * {
      margin: 0;
      padding: 0;
      box-sizing: border-box;
    }

    .box {
      margin: 100px;
      position: relative;
      width: 600px;
      height: 100px;
      background-color: #0ff;
      border-radius: 50px;
      overflow: hidden;
    }

    .moveBlock {
      position: absolute;
      top: 0;
      width: 50px;
      height: 100px;
      background-color: #00f;
      animation: moveName 5s infinite alternate;
      /* 属性
      linear     匀速
      steps(N) 分步-精灵图
      3s          延时时间
      infinite  重复
      alternate 往返
      forwards 停留在结束状态
      */

    }

    .box:hover .moveBlock {
      /* 鼠标悬停暂停动画 */
      animation-play-state: paused;
    }

    /* 定义动画 */
    @keyframes moveName {
      10% {
        width: 150px;
      }

      20% {
        width: 200px;
      }

      30% {
        width: 250px;
      }

      40% {
        width: 300px;
      }

      50% {
        width: 350px;
      }

      60% {
        width: 400px;
      }

      70% {
        width: 450px;
      }

      80% {
        width: 500px;
      }

      90% {
        width: 550px;
      }

      100% {
        width: 600px;
      }

    }
  </style>
</head>

<body>
  <div class="box">
    <div class="moveBlock"></div>
  </div>
</body>

</html>